{extend name="public:_base" /}
{block name="main"}
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 数据库管理 <span
        class="c-gray en">&gt;</span> 数据库管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                            href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>

<div class="page-container">

    <div class="cl pd-5 bg-1 bk-gray mt-20"><span class="l">
        <a class="btn btn-primary radius" onclick="handle('backup')" href="javascript:">
        <i class="Hui-iconfont">&#xe600;</i> 备份数据库</a></span>
    </div>

    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort">
            <thead>
            <tr class="text-c">
                <th>序号</th>
                <th>备份名称</th>
                <th>备份时间</th>
                <th>备份大小</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="list" id="vo"}
            <tr class="text-c va-m">
                <th scope="row">{$key}</th>
                <td>{$vo.name}</td>
                <td>{$vo.time}</td>
                <td>{$vo.size}</td>
                <td>
                    <a class="btn btn-xs btn-success" href="{:url('bak/index',['tp'=>'dowonload','name'=>$vo.name])}">下载</a>
                    <button type="button" class="btn btn-xs btn-warning" onclick="handle('restore','{$vo.name}')">还原</button>
                    <button type="button"  class="btn btn-xs btn-danger" onclick="handle('del','{$vo.name}')">删除</button>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>

    </div>
</div>
</div>
{/block}
{block name="js"}
<script>
    function handle(tp,name=''){
        if (tp){
            layer.load(1);
            $.post("{:url('bak/index')}",{tp:tp,name:name},function(response){
                if (response){
                    layer.msg(response, {icon: 1});
                    window.setTimeout("window.location=location.href",3000);
                }else{
                    layer.msg('操作失败，请重试!!', {icon: 5});
                }
            });
        }
    }
</script>
{/block}